Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack: lockdown inlining #1101

Merged
merged 5 commits into from
Apr 30, 2024
Merged

webpack: lockdown inlining #1101

merged 5 commits into from
Apr 30, 2024

Conversation

naugtur
Copy link
Member

@naugtur naugtur commented Mar 13, 2024

Some use-cases (including snaps) need to inline SES lockdown into the bundle file. It's impossible to flawlessly guess which file will be the one to load first on a new page in more complex configurations, so I went with a static list you have to provide. separate file lockdown remains the default approach.

Updated the README with explanation of this and got it up to date with implementation,

@naugtur naugtur requested a review from a team as a code owner March 13, 2024 11:39
@github-actions github-actions bot added documentation Docs, examples, tutorials, and associated tooling pkg:@lavamoat/webpack Changes in package @lavamoat/webpack labels Mar 13, 2024
packages/webpack/README.md Outdated Show resolved Hide resolved
packages/webpack/README.md Outdated Show resolved Hide resolved
- The plugin is attempting to add it as an asset to the compilation for the sake of Developer Experience. Feedback welcome.
- [SES lockdown][] must be added to the page without any bundling or transforming for any security guarantees to be sustained.
- The plugin is attempting to add it as an asset to the compilation for the sake of Developer Experience. `.js` extension is omitted to prevent minification.
- Optionally lockdown can be inlined into the bundle files. It's hard to determine which files are loaded when, so providing filenames for scripts that get to load as the first script on the page to apply lockdown only once is how one uses inlining.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is a little hard to understand

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was even harder to write 😅

packages/webpack/src/plugin.js Outdated Show resolved Hide resolved
packages/webpack/src/types.js Outdated Show resolved Hide resolved
Comment on lines +9 to +11
await t.notThrowsAsync(async () => {
t.context.build = await scaffold(webpackConfig)
}, 'Expected the build to succeed')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the side-effect here is little malodorous to me, but I'm not sure what a better solution would look like.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean is a side effect here. scaffold is running the build and returning information it collects. If it fails, we report it as a testsuite failure.

naugtur and others added 5 commits April 29, 2024 09:48
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
@naugtur naugtur merged commit 7444b47 into main Apr 30, 2024
12 checks passed
@naugtur naugtur deleted the naugtur/lockdown-inlining branch April 30, 2024 10:53
@github-actions github-actions bot mentioned this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Docs, examples, tutorials, and associated tooling pkg:@lavamoat/webpack Changes in package @lavamoat/webpack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants